import java.util.List;
import java.util.ArrayList;
import java.util.Random;

public final class GreedyRandomize extends Ejercicio
{ 
	public List <Integer> Vo1 = new ArrayList <Integer>();
	public List <Integer> Vo2 = new ArrayList <Integer>();
	public int cruces;
	
	protected Resultado DGIB
	(
			int n1, int v1[], int n2, int v2[], int m, Eje v1v2[],
			int np1, int vp1[], int np2, int vp2[], int mp, Eje vp1vp2[]
	){
		/*Constructiva aleatoria basada en constructiva 2*/
		
		Resultado res = new Resultado();
		
		int i; 
		int N1 = n1 + np1;
		int N2 = n2 + np2;
		
		Vo1 = new ArrayList <Integer>();
		Vo2 = new ArrayList <Integer>();
		
		Randomizar(vp1,np1);
		Randomizar(vp2,np2);
		
		Hconstructiva2 constructiva = new Hconstructiva2();
		constructiva.constructiva2(v1, n1, vp1, np1, vp2, np2, v1v2, m, vp1vp2, mp, v2, n2);
		
		int[] S1 = new int [N1],S2 = new int [N2];
		
		for(i = 0; i < N1; i++)
			S1[i] = Vo1.get(i);
		
		for(i = 0; i < N2; i++)
			S2[i] = Vo2.get(i);
		
		res.kid = cruces;
		res.n_iv1 = N1;
		res.iv1 = S1; 
		res.n_iv2 = N2;
		res.iv2 = S2;
		
		return res;
	}
	
	public void Randomizar(int[] V, int n)
	{
		Random cantMov = new Random();
		Random ind = new Random();
		Random ind2 = new Random();
		
		for(int h = 0; h < cantMov.nextInt(n)+1;h++)
		{
			int i, j;
			i = ind.nextInt(n);
			j = ind2.nextInt(n);
			swap(V,i,j);
		}
	}
}